//
//  MyBillsViewModel.m
//  HTP
//
//  Created by 王鑫 on 15/11/10.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "MyOrderViewModel.h"

@implementation MyOrderViewModel

- (void)getOrderByPrId:(NSString *)prId {
    tns1_getOrderByPrId *getOrder = [[tns1_getOrderByPrId alloc] init];
    getOrder.prId = prId;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return [binding getOrderByPrIdUsingParameters:getOrder headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}

-(void)addOrderByParent:(NSString *)parentId withTeacherSetId:(NSString *)teacherSetId andConut:(NSString *)count{
    tns1_addOrderByParentId *addOrder = [[tns1_addOrderByParentId alloc] init];
    addOrder.parentId = parentId;
    addOrder.teacherSetId = teacherSetId;
    addOrder.count = count;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return [binding addOrderByParentIdUsingParameters:addOrder headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}

-(void)getOrderDetailByOrderId:(NSString *)orderId{
    tns1_getOrderDetailByOrderId *getOrderDetail = [[tns1_getOrderDetailByOrderId alloc] init];
    getOrderDetail.orderId = orderId;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return [binding getOrderDetailByOrderIdUsingParameters:getOrderDetail headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}

-(void)getFinishOrderList:(NSString *)orderId length:(NSString *)length andParentId:(NSString *)parentId{
    tns1_getFinishOrderList *getFinishOrderList = [[tns1_getFinishOrderList alloc] init];
    getFinishOrderList.parentId = parentId;
    getFinishOrderList.length = length;
    getFinishOrderList.startOrderId = orderId;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return [binding getFinishOrderListUsingParameters:getFinishOrderList headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}
-(void)getUnFinishOrderList:(NSString *)parentId{
    tns1_getUnFinishOrderList *getUnFinishOrderList = [[tns1_getUnFinishOrderList alloc] init];
    getUnFinishOrderList.parentId = parentId;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return [binding getUnFinishOrderListUsingParameters:getUnFinishOrderList headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}
-(void)getFinishOrderDwonPull:(NSString *)orderId andParentId:(NSString *)parentId{
    tns1_getFinishOrderListDownPull *getOrderList = [[tns1_getFinishOrderListDownPull alloc] init];
    getOrderList.orderId = orderId;
    getOrderList.parentId = parentId;
    [WSDLNetWork shareInstance:^interfaceSoapBindingResponse *(interfaceSoapBinding *binding) {
        return  [binding getFinishOrderListDownPullUsingParameters:getOrderList headerElements:nil];
    } withResult:^(NSDictionary *message) {
        [self fetchResult:message];
    } throwError:^(NSError *error) {
        [self fetchError];
    }];
}
@end
